package pkg

import (
	"encoding/json"
	"fmt"
	"github.com/Baidu-AIP/golang-sdk/aip/censor"
	"weibo/basic/config"
)

func CheckText(text string) int {
	client := censor.NewClient(config.AppCfg.BaiDuYun.Ak, config.AppCfg.BaiDuYun.Sk)
	res := client.TextCensor(text)
	fmt.Println(res)
	var t T
	json.Unmarshal([]byte(res), &t)
	return t.ConclusionType
}

type T struct {
	ConclusionType int
}
